package hro.mobiqueen;

import android.app.Activity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.content.Intent;

public abstract class MobiBase extends Activity {

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        LoadMenu(menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        Intent intent = null;

        switch (item.getItemId()) {
            case R.id.btnNieuws:
                intent = new Intent(this, Nieuws.class);
                break;
            case R.id.btnPlattegrond:
                intent = new Intent(this, Plattegrond.class);
                break;
            case R.id.btnProgramma:
                intent = new Intent(this, Programma.class);
                break;
            case R.id.btnVrienden:
                intent = new Intent(this, Vrienden.class);
                break;
            default:
                throw new IllegalArgumentException("Type not supported.");
        }

        if (intent != null) {
            startActivity(intent);
        }

        return super.onOptionsItemSelected(item);
    }

    public void LoadMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.mobi_menu, menu);
    }
}
